{extends file="./main.tpl"}
{block name="head"}
<link href="css/user.css" rel="stylesheet" type="text/css" />
<script src="./js/jquery.min.js">
</script>
<script type="text/javascript">
$(document).ready(function()
{
  $("#userId").focus();
  $(".addFiles").click(function()
  {
    if($(".addFiles:last").val() == '')
    {
      $("#oneFiles").clone(true).appendTo("#mainDivFiles")
      .find('input[type="file"]').val('').end()
    }
  });
});
function selectInvoice(contractObj)
 {
 	var dataString = "contractId=" + $(".contractId").val();
 	$.ajax({
 	  type: "GET",
     url:'setInvoice.php',
     data:dataString,
     datatype:'html',
     success:function(data){
	    $("#invoiceId").html(data);  
	  }	
 	});
 }
 
function selectContract(contractObj)
{
	var dataString = "userId=" + $("#userId").val();
	$.ajax({
	  type: "GET",
    url:'uploadPicGetCont.php',
    data:dataString,
    datatype:'html',
    success:function(data){
    $(".contractId").html(data);  
  }	
	});
}

 
</script>
{/block}
{block name="body"}
<form enctype="multipart/form-data" action="{$smarty.server.PHP_SELF}" method="POST" class="register" style="width:1186px; margin-left: -80px;" > 
<table  align="center">
<body>
<h1 align="center" style="font-size:px; color:#5BA7E9;">Upload Document</h1>
<tr>
  <th class="text-field">User&nbsp;&nbsp;&nbsp;<label> 
    <select name="userId" id="userId" class="select" onChange="selectContract();" required >
      <option value="">Select User</option>
      {html_options values=$userArray.userId output=$userArray.fName}
    </select></label> 
  </th>
  <th class="text-field">Contract&nbsp;&nbsp;&nbsp;<label>
    <select name="contractId" class="contractId" onchange="selectInvoice(this);" required >
      <option value="">Select Contrect</option>
    </select></label>
  </th>
  <th class="text-field">
    <span id="invoiceId"></span>
  </th>
</tr>
<tbody id="mainDivFiles">
<tr id="oneFiles">
  <th class="text-field">Choose&nbsp;Image
    <input type="file" name="uploadFile[]" id="files" class="addFiles" multiple />
  </th>
</tr>
</tbody>
<tr>
  <td align="center" colspan="7">
    <input type="submit" name="submit" value="Submit" class="button">
  </td>
</tr>
 </table>
</form>
{/block}
